import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Login from "@/views/login/Login.vue";
import Home from "@/views/home/Home.vue";
import Layout from "@/layouts/Layout.vue";
import Ranking from "@/views/ranking/Ranking.vue";
const routes: Array<RouteRecordRaw> = [
  { path: "/", redirect: "/home" },
  { path: "/login", name: "login", component: Login },
  {
    path: "/layout",
    name: "Layout",
    component: Layout,
    children: [
      {
        path: "/home",
        name: "首页",
        component: Home,
        meta: {
          icon: "HomeFilled",
        },
      },
      {
        path: "/ranking",
        name: "排行榜",
        component: Ranking,
        meta: {
          icon: "Histogram",
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export { routes, router };
